home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $PROJECT: binary.datatype
- **
- ** $VER: subs.c 39.1 (11.02.95)
- **
- ** by
- **
- ** Stefan Ruppert , Windthorststraße 5 , 65439 Flörsheim , GERMANY
- **
- ** (C) Copyright 1995
- ** All Rights Reserved !
- **
- ** $HISTORY:
- **
- ** 11.02.95 : 039.001 : initial
- */
-
- #include "classbase.h"
-
- /* -------------------------- support functions --------------------------- */
-
- /*FS*/ ULONG notifyAttrChanges(Object * obj, void * ginfo, ULONG flags, ULONG tag1,...)
- {
- return(DoMethod(obj, OM_NOTIFY, &tag1, ginfo, flags));
- }
- /*FE*/
- /*FS*/ ULONG setSuperAttrs(Class *cl,Object * obj, void *ginfo,ULONG tag1,...)
- {
- return(DoSuperMethod(cl,obj, OM_SET, &tag1, ginfo));
- }
- /*FE*/
- /*FS*/ ULONG setAttrs(Object * obj, void *ginfo,ULONG tag1,...)
- {
- return(DoMethod(obj, OM_SET, &tag1, ginfo));
- }
- /*FE*/
- /*FS*/ ULONG updateAttrs(Object * obj, void *ginfo,ULONG tag1,...)
- {
- return(DoMethod(obj, OM_UPDATE, &tag1, ginfo));
- }
- /*FE*/
-
- /* ----------------------- async method invokation ------------------------ */
-
- /*FS*/ ULONG DoAsyncMethod(Object *obj,Msg msg,ULONG tag1,...)
- {
- return(DoAsyncMethodA(obj,msg,(struct TagItem *) &tag1));
- }
- /*FE*/
- /*FS*/ /*"ULONG DoAsyncMethodA(Object *obj,Msg msg,struct TagItem *tagList)"*/
-
- struct AsyncMethodMsg
- {
- struct Message amm_ExecMessage;
- Object *amm_Object;
- Msg amm_Msg;
- };
-
- ULONG DoAsyncMethodA(Object *obj,Msg msg,struct TagItem *tagList)
- {
- Class *cl = OCLASS(obj);
- struct ClassBase *cb = (struct ClassBase *) cl->cl_UserData;
- struct AsyncMethodMsg amsg;
- struct Process *proc = NULL;
- struct MsgPort *mport;
- ULONG retval = FALSE;
-
- if((mport = CreateMsgPort()))
- {
- amsg.amm_Object = obj;
- amsg.amm_Msg = msg;
-
- amsg.amm_ExecMessage.mn_Node.ln_Type = NT_MESSAGE;
- amsg.amm_ExecMessage.mn_ReplyPort = mport;
-
- if((proc = CreateNewProcTags(NP_Entry,asyncmethodfunc,
- (tagList) ? TAG_MORE : TAG_IGNORE,tagList,
- TAG_DONE)))
- {
- D(bug("sending object : %lx, msg : %lx\n",obj,msg));
-
- PutMsg(&proc->pr_MsgPort,&amsg.amm_ExecMessage);
- WaitPort(mport);
- retval = TRUE;
- }
-
- DeleteMsgPort(mport);
- }
- return((ULONG) proc);
- }
-
- ClassCall ULONG asyncmethodfunc(void)
- {
- struct Process *proc = (struct Process *) FindTask(NULL);
- Object *obj;
- Msg msg;
- struct AsyncMethodMsg *amsg;
-
- WaitPort(&proc->pr_MsgPort);
- amsg = (struct AsyncMethodMsg *) GetMsg(&proc->pr_MsgPort);
- obj = amsg->amm_Object;
- msg = amsg->amm_Msg;
- ReplyMsg(&amsg->amm_ExecMessage);
-
- D(bug("recieved object : %lx, msg : %lx\n",obj,msg));
-
- return(DoMethodA(obj,msg));
- }
- /*FE*/
-
-